package com.shop.loan.model;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.upms.helper.HyperModelUpdateVo;

import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import java.math.BigDecimal;

@Setter
@Getter
@Entity
@Table(name = "s_machine_rule")
@Erupt(
        name = "机审规则表"
)
public class MachineRule extends HyperModelUpdateVo {

    @EruptField(
            views = @View(title = "规则名称"),
            edit = @Edit(title = "规则名称", notNull = true)
    )
    private String name;


    @EruptField(
            views = @View(title = "规则说明"),
            edit = @Edit(title = "规则说明", type = EditType.TEXTAREA, notNull = true)
    )
    private String remark;

    @EruptField(
            views = @View(title = "类型"),
            edit = @Edit(
                    title = "类型",
                    type = EditType.CHOICE,
                    notNull = true,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "数值>", value = "1"),
                                    @VL(label = "数值<", value = "2"),
                                    @VL(label = "其他", value = "5"),
                            }
                    ))
    )
    private Integer type;


    @EruptField(
            views = @View(title = "字段来源"),
            edit = @Edit(
                    title = "字段来源",
                    notNull = true,
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "用户基本信息", value = "0"),
                                    @VL(label = "探针C", value = "1"),
                                    @VL(label = "全景雷达", value = "2"),
                                    @VL(label = "其他", value = "5"),
                            }
                    ))
    )
    private Integer reportType;


    @EruptField(
            views = @View(title = "规则标识"),
            edit = @Edit(title = "规则标识", notNull = true)
    )
    private String ruleTag;

    @EruptField(
            views = @View(title = "数据字段"),
            edit = @Edit(title = "数据字段")
    )
    private String dataField;


    @Lob
    @EruptField(
            views = @View(title = "匹配内容"),
            edit = @Edit(title = "匹配内容", type = EditType.TEXTAREA)
    )
    private String detail;

    @EruptField(
            views = @View(title = "扣分", width = "100px"),
            edit = @Edit(title = "扣分")
    )
    private BigDecimal subScore;

    @EruptField(
            views = @View(title = "状态"),
            edit = @Edit(
                    title = "状态",
                    search = @Search,
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "正常",
                            falseText = "下线"
                    )
            )
    )
    private Boolean status = true;

}
